package thesis.database;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

public class TaxiMapper implements RowMapper<Taxi> {

	@Override
	public Taxi mapRow(ResultSet rs, int rowNum) throws SQLException {
		Taxi taxi = new Taxi();
		taxi.setTaxiId(rs.getInt("taxi_id"));
		taxi.setImei(rs.getString("imei"));
		taxi.setNumberOfSeat(rs.getInt("number_of_seat"));
		taxi.setNumberPlate(rs.getString("number_plate"));
		taxi.setDescription(rs.getString("description"));
		taxi.setStatus(rs.getInt("status"));
		taxi.setNewestLatitude(rs.getString("newest_latitude"));
		taxi.setNewestLongitude(rs.getString("newest_longitude"));
		taxi.setExpirationTime(rs.getTimestamp("expiration_time"));
		taxi.setDisplayColor(rs.getInt("display_color"));
		taxi.setSimNumber(rs.getString("sim_number"));
		taxi.setIpAddress(rs.getString("ip_address"));
		taxi.setPortListen(rs.getInt("port_listen"));
		taxi.setActive(rs.getBoolean("is_active"));
		taxi.setCreationTime(rs.getTimestamp("creation_time"));
		taxi.setLastUpdate(rs.getTimestamp("last_update"));
		taxi.setGpsData(rs.getString("gps_data"));
		taxi.setDriverBirthday(rs.getTimestamp("driver_birthday"));
		taxi.setDriverDateStart(rs.getTimestamp("driver_day_start"));
		taxi.setDriverEmail(rs.getString("driver_email"));
		taxi.setDriverExpireDay(rs.getTimestamp("driver_expire_day"));
		taxi.setDriverIdentifyNumber(rs.getString("driver_identify_number"));
		taxi.setDriverLicenseCode(rs.getString("driver_license_code"));
		taxi.setDriverLicenseType(rs.getString("driver_license_type"));
		taxi.setDriverName(rs.getString("driver_name"));
		taxi.setDriverPhone(rs.getString("driver_phone"));
		taxi.setDriverShiftNumber(rs.getInt("driver_shift_number"));
		return taxi;
	}

}
